#include <iostream>
using namespace std;
class Rectangle{
private:
	int lefttop;
	int righttop;
	int leftoff;
	int rightoff;
public:
	Rectangle(int a,int b,int c,int d);
	void showLeftTop();   //输出左上顶点的坐标 
	void showRightTop();  //输出右上顶点的坐标 
	void showLeftBottom();  //输出左下顶点的坐标 
	void showRightBottom();  //输出右下顶点的坐标 
	int getHeight();
	int getWidth();
	int getArea();
	int getPerimeter();
};
Rectangle::Rectangle(int a,int b,int c,int d){
	if(b<d||a<c){
		leftoff=0;
		lefttop=0;
		rightoff=0;
		righttop=0;
	}
	else{
		leftoff=d;
		lefttop=c;
		rightoff=b;
		righttop=a;
	}
}
void Rectangle::showLeftBottom(){
	std::cout<<lefttop<<","<<leftoff<<endl;
}
void Rectangle::showLeftTop(){
	std::cout<<leftoff<<","<<righttop<<endl;
}
void Rectangle::showRightBottom(){
	std::cout<<rightoff<<","<<lefttop<<endl;
}

void Rectangle::showRightTop(){
	std::cout<<righttop<<","<<rightoff<<endl;
}
int Rectangle::getHeight(){
	return righttop-lefttop;
}
int Rectangle::getWidth(){
	return rightoff-leftoff;
}
int Rectangle::getArea(){
	return getHeight()*getWidth();
}
int Rectangle::getPerimeter(){
	return 2*getHeight()+2*getWidth();
}
